package com.sy.controller;

import com.sy.bean.management.GoodsQuery;
import com.sy.common.bean.PageBean;
import com.sy.common.bean.ResultBean;
import com.sy.common.controller.BaseController;
import com.sy.common.utils.BeanOfMap;
import com.sy.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "商品管理")
@RequestMapping("/api/set")
public class GoodsController extends BaseController {
    @Autowired
    GoodsService goodsService;
    @PostMapping("/goods/search")
    @ApiOperation("商品搜索")
    public ResultBean<PageBean> search(@RequestBody GoodsQuery query){
       PageBean pageBean = goodsService.query(BeanOfMap.bom(query));
        return success("商品搜索结果",pageBean);
    }
}
